package de.dhbw.karlsruhe.picsim.gui.data;

import de.dhbw.karlsruhe.picsim.model.memory.CommandRegisterAddress;
import de.dhbw.karlsruhe.picsim.model.memory.DirectAddressAbleStack;

/**
 * Created by IntelliJ IDEA.
 * User: goesen
 * Date: Apr 29, 2010
 * Time: 2:06:11 PM
 */
public final class SwingStackElementImpl implements SwingStackElement {
    private final DirectAddressAbleStack stack;
    private final int number;

    public SwingStackElementImpl(final DirectAddressAbleStack stack, final int number) {

        this.stack = stack;
        this.number = number;
    }

    @Override
    public boolean isCurrent() {
        return stack.getPointer() == number;
    }

    @Override
    public CommandRegisterAddress getValue() {
        return stack.getAddress(number);
    }
}
